Repository navigation
aggregator(cost-explorer): null-prototype setups store (#2851) - #3491
Merged
Merged
Conversation
loadSetups() returned the JSON.parse result directly, so a setup named __proto__ assigned the store prototype instead of becoming an entry (silently never saved), and an imported __proto__ entry mutated the live store prototype while being dropped. loadSetups now copies parsed own keys into Object.create(null); save/import/export handlers unchanged. Regression test extracts the shipped loadSetups/storeSetups and drives the save/import cores over the __proto__/constructor/toString/ordinary matrix.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 30 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2851.
Problem
The cost-explorer saved-setups store keyed setups by name in a plain
JSON.parse'd object. A setup named__proto__assigned the store's prototype instead of becoming an entry — silently never saved — and importing a setups file with a__proto__entry mutated the live store object's prototype (its fields leaked into reads) while the entry itself was dropped on store. Confirmed by triage task 4018 probe re-runs on current main.Fix (pinned by triage)
loadSetups()now copies the parsed object's own keys intoObject.create(null)and returns that; the parse-failure fallback is likewise a null-prototype empty store. On a null-prototype object, the save handler'sall[name] = ...and the import handler'sall[k] = ...create ordinary own entries for every name including__proto__;JSON.stringify/Object.keysbehave as before, and there is no prototype to mutate. No name is rejected and no other handler changes.Tests
New
pm-stack/aggregator/test/setups-store-2851.test.tsextracts the shippedloadSetups/storeSetupsfromsrc/render.tsand drives the verbatim save/import handler cores against a stub localStorage:__proto__setup saves, reloads, and exports as a real own entry{"__proto__": {...}, "Real": {...}}stores both as entries, store prototype is null, nothing leaks into unrelated objectsconstructor/toString/ ordinary unchanged4/4 pass with the fix; 3/4 fail on unfixed code. Full aggregator suite: 238 pass / 37 fail / 30 errors vs clean-main baseline 234 / 37 / 30 — identical pre-existing failures, +4 new passes, zero regressions.
Queue task 5444 (repo-health-code-pilot), Lane D.
Need help on this PR? Tag
@codesmith-botwith what you need.